home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / video / fly8111-.000 / fly8111- / fly8 / leak.awk < prev    next >
Text File  |  1979-12-31  |  469b  |  32 lines

  1. # leak.awk
  2. #
  3. # read a Fly8 log and highlight bad/missing memory frees. You need to first
  4. # compile FLy8 with -DMEM_DEBUG.
  5. #
  6.  
  7. {
  8.     if ($1 == "strdup" || $1 == "strfree") {
  9.         str = $2
  10.         next
  11.     }
  12.  
  13.     if ($1 == "alloc") {
  14.         if ("" == str)
  15.             str = $2
  16.         mem[$3] = str
  17.     } else if ($1 == "free") {
  18.         if ("" == mem[$3])
  19.             printf ("no alloc: %s\n", $3)
  20.         else
  21.             delete mem[$NF]
  22.     }
  23.     str = ""
  24. }
  25.  
  26. END {
  27.     for (x in mem) {
  28.         printf ("no free:  %s %s\n", x, mem[x])
  29.         delete mem[x]
  30.     }
  31. }
  32.